/**
 * This file is part of Wireless TransFer.
 *
 *   Wireless TransFer is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *	
 *   Wireless TransFer is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with Wireless TransFer.  If not, see <http://www.gnu.org/licenses/>.
 *
 *	 Copyright (C) 2011
 *   @author prebz
 */


package com.wirelesstransfer;

import com.wirelesstransfer.activity.preference.Preference;
import com.wirelesstransfer.activity.receive.Receive;
import com.wirelesstransfer.activity.send.Send;
import com.wirelesstransfer.activity.status.Status;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class Main extends TabActivity {
	
	private TabHost tabHost;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Resources res = getResources(); 
        tabHost = getTabHost();  
        TabHost.TabSpec spec;  
        Intent intent;
        
        intent = new Intent().setClass(this, Status.class);
        spec = tabHost.newTabSpec("status").setIndicator(res.getString(R.string.status_TAB),
                          res.getDrawable(R.drawable.emblem_linux))
                      .setContent(intent);
        tabHost.addTab(spec);

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, Send.class);

        // Initialize Send and add it to the TabHost
        spec = tabHost.newTabSpec("send").setIndicator(res.getString(R.string.send_TAB),
                          res.getDrawable(R.drawable.green_folder_mail))
                      .setContent(intent);
        tabHost.addTab(spec);

        // Initialize Receive and add it to the TabHost
        intent = new Intent().setClass(this, Receive.class);
        spec = tabHost.newTabSpec("receive").setIndicator(res.getString(R.string.receive_TAB),
                          res.getDrawable(R.drawable.green_folder_downloads))
                      .setContent(intent);
        tabHost.addTab(spec);

        // Initialize Preference and add it to the TabHost
        intent = new Intent().setClass(this, Preference.class);
        spec = tabHost.newTabSpec("preferences").setIndicator(res.getString(R.string.preferences_TAB),
                          res.getDrawable(R.drawable.preferences_desktop_personal))
                      .setContent(intent);
        tabHost.addTab(spec);
        
        tabHost.setCurrentTab(0);
        
    }
    
	/**
	 * Switch to a specific tab
	 * @param tab number
	 */
	public void switchTab(int tab){
        tabHost.setCurrentTab(tab);
}

	
}